import type { DataType } from "../model/index";
import service from "../../../utils/service";
//查询所有保安数据
export function searchList(setData: Function, setLenth: Function) {

    //发请求修改表格数据状态
    service({
        url: "/security",
        method: "get",

    }).then(
        res => {
            console.log("res", res);
            //给每条数据加key
            res.data.forEach(
                (element: DataType, index: number) => {
                    element.key = index + ''
                }
            )
            //修改表格数据状态
            setData(res.data);
            setLenth(res.data.length);
        })
}

